import {
	request
} from '@/plugins/axios';
const token = uni.getStorageSync('token');

/**
 * @param {Object} code微信登录
 */
export function getOpenId(code) {
    return request({
        url: `http://localhost:8790/data-mood-api/app/user/getOpenid`,
        method: 'GET',
		params: { code },
    });
}

/**
 * @param {Object} openid微信一键登录
 */
export function weixinlogin(openid) {
    return request({
        // 替换为具体路径前缀
        url: `http://localhost:8790/data-mood-api/app/user/loginByWechat`,
        method: 'GET',
		params: { openid },
    });
}
/**
 * 获取情绪列表
 */
export function moodSceneList() {
    return request({
        url: `http://localhost:8790/data-mood-api/app/moodScene/moodSceneList`,
        method: 'get',
        headers: {
            'Authorization': `${token}`
        }
    });
}

/**
 *获取用户名称和头像
 */
export function getUserInfo(avatar,nickname) {
    return request({
        url: `http://localhost:8790/data-mood-api/app/user/getUserInfo`,
        method: 'get',
        headers: {
            'Authorization': `${token}`
        },
		params:{avatar,nickname}
    });
}

export function collectMusic(musicId) {
    return request({
        url: `http://localhost:8790/data-mood-api/app/user/collectMusic`,
        method: 'get',
        headers: {
            'Authorization': `${token}`
        },
		params:{musicId}
    });
}
